<?php
class UTParser extends UnitTestCase 
{
    public function testComplexSimpleturn()
    {
        $parsed = (string) new Parser("R'");
        $this->assertEqual($parsed, "R R R");
    }
 
    public function testComplexTurns()
    {
        $parsed = (string) new Parser("R2 U R U R' U' R' U' R' U R'");
        $this->assertEqual($parsed, "R R U R U R R R U U U R R R U U U R R R U R R R");
    }

    public function testComplexAlg() 
    {
        $parsed = (string) new Parser("l' U R' D2 R U' R' D2 l R");
        $this->assertEqual($parsed, "L M L M L M U R R R D D R U U U R R R D D L M R");

        $parsed = (string) new Parser("F R U' R' U' R U l' U' l U R' U' l' U l F'");
        $this->assertEqual($parsed, "F R U U U R R R U U U R U L M L M L M U U U L M U R R R U U U L M L M L M U L M F F F");

        $parsed = (string) new Parser("x R' U R' D2 R U' R' D2 R2 x'");
        $this->assertEqual($parsed, "R M M M L L L R R R U R R R D D R U U U R R R D D R R R M M M L L L R M M M L L L R M M M L L L");
    }

    public function testOrientationTurns()
    {
        $parsed = (string) new Parser("x R' U R' D2 R U' R' D2 R2 x'");
        $this->assertEqual($parsed, "R M M M L L L R R R U R R R D D R U U U R R R D D R R R M M M L L L R M M M L L L R M M M L L L");
    }
}
?>
